package biznussoft.metercor.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import biznussoft.metercor.R;
import biznussoft.metercor.model.ItemModel;

public class SurveyAdapter  extends BaseAdapter{
	
	private ArrayList<ItemModel> listdata;
	private Context mContext;
	public SurveyAdapter(Context context, ArrayList<ItemModel> list) {
		// TODO Auto-generated constructor stub
		this.listdata = list;
		this.mContext = context;
		
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return listdata.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public class ViewHolder{
		public TextView name;
		public TextView phno;
		public TextView title;
		public TextView email;
	}

	public View getView(int position, View v, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		ViewHolder holder;
		if(v == null){
			holder = new ViewHolder();
			LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = inflator.inflate(R.layout.contact_listview, null);
			holder.name  = (TextView) v.findViewById(R.id.tvContactLastName);
			holder.phno = (TextView) v.findViewById(R.id.tvContactPhone);
			holder.title  = (TextView) v.findViewById(R.id.tvContactTitle);
			holder.email = (TextView) v.findViewById(R.id.tvContactEmail);
			v.setTag(holder);
		}else{
			holder = (ViewHolder) v.getTag();
		}
		
		ItemModel bean = listdata.get(position);
		holder.name.setText(bean.getName());
		/*holder.title.setText(bean.getConductedBy());
		holder.phno.setText(bean.getDate());
		holder.email.setText(bean.getNoEmployees());*/
		
		return v;
	}

}
